package com.gy.api.sms.controller;

import com.gy.api.base.R;
import com.gy.api.sms.req.SmsRequest;
import com.gy.api.sms.service.DynamicMessageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;


@RestController
@RequestMapping("/sms")
@Api(tags = "短信发送接口")
public class SmsController {
    @Resource
    private DynamicMessageService smsService;

    @PostMapping("/send")
    @ApiOperation(value = "发送动态短信", notes = "根据模板ID来发送动态短信")
    public R<String> sendSms(@RequestBody SmsRequest smsRequest) {
        try {
//            smsService.sendDynamicMessage(smsRequest.getBusinessName(), smsRequest.getMobile(), smsRequest.getParams());
            return R.ok("短信发送成功");
        } catch (Exception e) {
//            e.printStackTrace();
            return R.ok("短信发送失败");
        }
    }
}
